#include <iostream>
#include <vector>
#include <string>
#include <sstream>
using namespace std;

class Solution{
unsigned long ipv4_to_long(const std::string& ip) {
    unsigned long result = 0;
    std::istringstream iss(ip);
    std::string segment;
    int shift = 24;

    while (std::getline(iss, segment, '.')) {
        int num = std::stoi(segment);
        result |= (static_cast<unsigned long>(num) << shift);
        shift -= 8;
    }

    return result;
}

std::string long_to_ipv4(unsigned long ip) {
    std::ostringstream oss;
    oss << ((ip >> 24) & 0xFF) << "."
        << ((ip >> 16) & 0xFF) << "."
        << ((ip >> 8) & 0xFF) << "."
        << (ip & 0xFF);
    return oss.str();
}

};